package com.masterclient.app.businessmodule.vipmodule.persenter;

import com.eoner.baselib.container.CommonBaseResponse;
import com.eoner.baselib.presenter.FCBaseCallBack;
import com.eoner.baselib.presenter.FCBasePresenter;
import com.masterclient.app.businessmodule.vipmodule.api.ProfitsListService;
import com.masterclient.app.businessmodule.vipmodule.bean.Profit;

public class ProfitsListPresenter extends ProfitsListContract.Presenter {


    @Override
    public void getProfits(boolean showPageLoading, int status,int page, int size) {
        if (showPageLoading)
            mView.baseShowPageLoading(false);
        mRxManager.add(toNewSubscribe(ProfitsListService.getInstance().getProfits(status,page, size),
                new FCBaseCallBack<CommonBaseResponse<Profit>>() {
                    @Override
                    public void onSuccess(CommonBaseResponse<Profit> bean) {
                        mView.profits(bean.getData());
                    }

                    @Override
                    public void onNetWorkError(String errorMsg) {
                        super.onNetWorkError(errorMsg);
                        mView.error(FCBasePresenter.WEB_FAILED_STR);
                    }

                    @Override
                    public void onServiceError(CommonBaseResponse<Profit> obj) {
                        super.onServiceError(obj);
                        mView.error(FCBasePresenter.SERVER_FAILED_STR);
                    }
                }));
    }

}
